/**
 * Created by apple on 2017/7/2.
 */
import React, {Component} from 'react';
import {
  StyleSheet,
  Text,
  View,
  ListView,
  Image,
  TouchableOpacity,
} from 'react-native';

export default class RepositoryCell extends Component {
  render() {
    return (
    <TouchableOpacity style={styles.container}>
      <View style={styles.cell_container}>
        <Text style={styles.title}>{this.props.data.full_name}</Text>
        <Text style={styles.description}>{this.props.data.description}</Text>
        <View style={{flexDirection: 'row',justifyContent:'space-between'}}>
          <View style={{flexDirection:'row',alignItems:'center'}}>
            <Text>Author</Text>
            <Image style={{height: 22, width: 22}} source={{uri: this.props.data.owner.avatar_url}}/>
          </View>
          <View style={{flexDirection: 'row',alignItems:'center'}}>
            <Text>stars:</Text>
            <Text>{this.props.data.stargazers_count}</Text>
          </View>
          <View>
            <Image style={{width:22,height:22}} source={require('../../res/images/ic_star.png')}/>
          </View>
        </View>
      </View>
    </TouchableOpacity>
    )
  }
}

const styles = StyleSheet.create({
  container:{
    flex:1
  },
  title:{
    fontSize:16,
    marginBottom:2,
    color:'#212121'
  },
  description:{
    fontSize:14,
    marginBottom:2,
    color:"#757575"
  },
  cell_container:{
    backgroundColor:'#fff',
    padding:10,
    marginLeft:5,
    marginRight:5,
    marginVertical:3,
    borderWidth:.5,
    borderRadius:2,
    shadowColor:'gray',
    shadowOffset:{width:.5,height:.5},
    borderColor:'#ddd',
    shadowOpacity:.4,
    elevation:2,//设置android下的阴影
  }
});